package satir.testcase.card;


import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import satir.card.ActCard;
import satir.player.Player;

public class ActCard_activateCard_1 extends TestCase{
	private Player player;
	private ActCard ac;
	
	@Before
	public void setUp() throws Exception {
		player = new Player(); 
		ac = new ActCard("Act Card 1", "Please sing 1 song with any family member.");
	}

	@After
	public void tearDown() throws Exception {
	}

	/**
	 * Step number : 1
	 * Goal: Display the Act card information
	 */
	@Test
	public void testActivateCard() {
		String input = "NY";
		System.setIn(new ByteArrayInputStream(input.getBytes()));
		final ByteArrayOutputStream systemOut = new ByteArrayOutputStream();
		System.setOut(new PrintStream(systemOut));
		ac.activateCard(player);
		String output = systemOut.toString();
		int nameStartIndex = output.indexOf('\n') + 1;
		int descriptionStartIndex = output.indexOf('\n', nameStartIndex)+1;
		String actualResult = output.substring(nameStartIndex, output.indexOf('\n', nameStartIndex)-1);
		actualResult += output.substring(descriptionStartIndex, output.indexOf('\n', descriptionStartIndex)-1);
		assertEquals("Act Card 1Please sing 1 song with any family member.",actualResult);
		
	}
}
